Skip to content

Emacs syntax highlighting and file-type detection#942

Merged
rneatherway merged 3 commits into
masterfrom
unknown repository
Feb 15, 2019
Merged

Emacs syntax highlighting and file-type detection#942
rneatherway merged 3 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 15, 2019

Copy link
Copy Markdown

Emacs support similar to the Vim support. Relevant for Make syntax highlightning configs public.

I emphasize that this is a simple Emacs mode, and that we have much more advanced, but untable, mode internally.

Ping @rneatherway as another Emacs person.

Comment thread misc/emacs/ql-mode-base.el Outdated
(defconst ql--at-type-regex "\\_<@\\w+\\>")
(defconst ql--predicate-regex "\\(\\_<\\w+\\(\\+\\|\\*\\)?\\_>\\)\\s-*(")
(defconst ql--primitive-type-regex (regexp-opt '("int" "string" "float" "boolean" "date") 'symbols))
(defconst ql--annotation-regex (regexp-opt '("abstract" "cached" "external" "final" "transient" "library" "private" "deprecated" "override" "query" "language" "bindingset") 'words))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably makes sense to keep this consistent with the vim list. This list additionally has transient, while vim has:

monotonicAggregates
noinline
nomagic
noopt
pragma

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, I have changed it such that we now highlight all arguments to the parameterized annotations pragma, language and bindingset. In that way, we do not have to update the highlightning rules when new pragmas or languages are introduced.

Comment thread misc/emacs/ql-mode-base.el Outdated
(defconst ql--predicate-regex "\\(\\_<\\w+\\(\\+\\|\\*\\)?\\_>\\)\\s-*(")
(defconst ql--primitive-type-regex (regexp-opt '("int" "string" "float" "boolean" "date") 'symbols))
(defconst ql--annotation-regex (regexp-opt '("abstract" "cached" "external" "final" "transient" "library" "private" "deprecated" "override" "query") 'words))
(defconst ql--parameterized-annotation-regex "\\<\\(pragma\\|language\\|bindingset\\) *\\[ *[a-z, ]*\\]")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a-z should also allow uppercase for monotonicAggregate to work.

It's slightly unfortunate that bindingset[this] and bindingset[result] are not highlighted correctly, although I'm not sure how important you feel that is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I have simplified it. It is now consistent with Vim.

Example display when loaded in emacs -q:
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, this looks good to me locally.

@rneatherway rneatherway merged commit 5754eb6 into github:master Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant